import createAxios from '/@/utils/axios'

const controllerUrl:string = '/admin/'

export function captcha(): ApiPromise {
    return createAxios({
        url: controllerUrl + 'captcha',
        method: 'GET'
    }) as ApiPromise
}

export function login(data: anyObj): ApiPromise {
    return createAxios({
        url: controllerUrl + 'login',
        data: data,
        method: 'POST'
    }) as ApiPromise
}

export function logout() {
    return createAxios({
        url: controllerUrl + 'logout',
        method: 'POST'
    }) as ApiPromise
}

export function getInfo() {
    return createAxios({
        url: controllerUrl + 'getInfo',
        method: 'GET'
    }) as ApiPromise
}

export function editInfo(data: anyObj): ApiPromise {
    return createAxios({
        url: controllerUrl + 'editInfo',
        data: data,
        method: 'PATCH'
    }) as ApiPromise
}

export function editPassword(data: anyObj): ApiPromise {
    return createAxios({
        url: controllerUrl + 'editPassword',
        data: data,
        method: 'PATCH'
    }) as ApiPromise
}
